gh-153569: simplify tokenizer state and source storage - #156484
Draft
pablogsal wants to merge 16 commits into
Draft
gh-153569: simplify tokenizer state and source storage#156484pablogsal wants to merge 16 commits into
pablogsal wants to merge 16 commits into
Conversation
| } | ||
|
|
||
| static int | ||
| fuzz_tokenizer(const char *data, size_t size) |
Member
There was a problem hiding this comment.
Please move it to python/library-fuzzers (yes, name is a little misleading). We aren't adding anything to _xxtestfuzz as we are planning to move it all to the repository.
Member
There was a problem hiding this comment.
@pablogsal a little ping FYI, since I see you're working on this.
Member
Author
|
Do not review until #156482 lands. |
pablogsal
force-pushed
the
gh-153569-tokenizer-validation-tools-clean
branch
from
August 28, 2026 18:40
5505010 to
68400fb
Compare
pablogsal
force-pushed
the
gh-153569-tokenizer-validation-tools-clean
branch
from
August 28, 2026 19:35
68400fb to
7432a67
Compare
pablogsal
force-pushed
the
gh-153569-tokenizer-validation-tools-clean
branch
from
August 28, 2026 22:44
bb197e7 to
962c0c5
Compare
pablogsal
force-pushed
the
gh-153569-tokenizer-validation-tools-clean
branch
from
August 28, 2026 23:48
962c0c5 to
eae3e33
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The tokenizer was keeping several copies of the same positions and a fixed 150-entry mode array in every tokenizer. F- and t-string expressions and comments now use source spans, while their modes live in a small stack that grows only for deeply nested strings. Each mode owns its comment spans, so nesting no longer needs a second stack kept in sync. Prefix handling also uses one enum for f-, t-, and raw strings, so the lexer no longer reconstructs that state from token bytes.
Prepared input is normalized once and stored in one buffer. The reader splits it directly, keeps streamed f- and t-strings in the active buffer, and owns pointer relocation. Line-based tokenizer errors use the current line even while a formatted string keeps a wider buffer. This removes the per-line tables, implicit-newline bitset, cursor and buffer helpers, source aliases, duplicated reader counters, and the extra parser error state. This follows #156482 as the next part of #153569.